package com.example.courseservice.repository;

import com.example.courseservice.entity.Material;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MaterialRepository extends JpaRepository<Material, String>, JpaSpecificationExecutor<Material> {
    List<Material> findByChapter_ChapterId(String chapterId);
    List<Material> findByCourse_CourseId(String courseId);
    List<Material> findByCourse_CourseIdAndChapter_ChapterId(String courseId, String chapterId);
    List<Material> findByMaterialLabelContaining(String keyword);
    List<Material> findByMaterialNameContaining(String keyword);
}